import { _decorator, Component, Node, Slider, ProgressBar } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('UpDownStreamControls')
export class UpDownStreamControls extends Component {
    start() {
        this.node.children[1].on(Node.EventType.TOUCH_START, this.onTouchStartUp, this);
        this.node.children[1].on(Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
        this.node.children[1].on(Node.EventType.TOUCH_END, this.onTouchEnd, this);

        this.node.children[2].on(Node.EventType.TOUCH_START, this.onTouchStartDown, this);
        this.node.children[2].on(Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
        this.node.children[2].on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
    }

    update(deltaTime: number) {

    }

    onTouchStartUp() {
        this.node.children[0].getComponent(Slider).progress = 0.75
    }

    onTouchStartDown() {
        this.node.children[0].getComponent(Slider).progress = 0.25
    }

    onTouchEnd() {
        this.node.children[0].getComponent(Slider).progress = 0.5
    }

}


